﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BPM.Entity;
using System.Data.Entity.ModelConfiguration;

namespace BPM.Service.Mappings
{
	internal class ProductAssembleDefinitionItemConfiguration : EntityConfiguration<ProductAssembleDefinitionItem>
	{
		public ProductAssembleDefinitionItemConfiguration()
		{
			this.HasRequired(p => p.ProductAssembleDefinition)
				.WithMany(pad => pad.ItemList)
				.HasConstraint((pi, m) => pi.ProductAssembleDefinitionId == m.Id)
				.WillCascadeOnDelete();

			this.HasRequired(p => p.MaterialDefinition)
				.WithMany()
				.HasConstraint((pi, m) => pi.MaterialDefinitionId == m.Id)
				.WillCascadeOnDelete(false);
		}
	}
}